﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Rendering.CommandBufferExtensions
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System.Runtime.CompilerServices;
using UnityEngine.Bindings;
using UnityEngine.Scripting;

#nullable disable
namespace UnityEngine.Rendering
{
  /// <summary>
  ///   <para>Static class providing extension methods for CommandBuffer.</para>
  /// </summary>
  [NativeHeader("Runtime/Export/Graphics/RenderingCommandBufferExtensions.bindings.h")]
  [UsedByNativeCode]
  public static class CommandBufferExtensions
  {
    [FreeFunction("RenderingCommandBufferExtensions_Bindings::Internal_SwitchIntoFastMemory")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void Internal_SwitchIntoFastMemory(
      [NotNull("NullExceptionObject")] CommandBuffer cmd,
      ref RenderTargetIdentifier rt,
      FastMemoryFlags fastMemoryFlags,
      float residency,
      bool copyContents);

    [FreeFunction("RenderingCommandBufferExtensions_Bindings::Internal_SwitchOutOfFastMemory")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void Internal_SwitchOutOfFastMemory(
      [NotNull("NullExceptionObject")] CommandBuffer cmd,
      ref RenderTargetIdentifier rt,
      bool copyContents);

    /// <summary>
    ///   <para>Adds a command to put a given render target into fast GPU memory.</para>
    /// </summary>
    /// <param name="rid">The render target to put into fast GPU memory.</param>
    /// <param name="fastMemoryFlags">The memory layout to use if only part of the render target is put into fast GPU memory, either because of the residency parameter or because of fast GPU memory availability.</param>
    /// <param name="residency">The amount of the render target to put into fast GPU memory. Valid values are 0.0f - 1.0f inclusive.
    /// A value of 0.0f is equal to none of the render target, and a value of 1.0f is equal to the whole render target.
    ///                 </param>
    /// <param name="copyContents">When this value is true, Unity copies the existing contents of the render target into fast memory.
    /// When this value is false, Unity does not copy the existing contents of the render target into fast memory.
    /// Set this value to true if you plan to add to the existing contents, and set it to false if you plan to overwrite or clear the existing contents.
    /// Where possible, set this value to false for better performance.
    ///                 </param>
    /// <param name="cmd"></param>
    [NativeConditional("UNITY_XBOXONE || UNITY_GAMECORE_XBOXONE")]
    public static void SwitchIntoFastMemory(
      this CommandBuffer cmd,
      RenderTargetIdentifier rid,
      FastMemoryFlags fastMemoryFlags,
      float residency,
      bool copyContents)
    {
      CommandBufferExtensions.Internal_SwitchIntoFastMemory(cmd, ref rid, fastMemoryFlags, residency, copyContents);
    }

    /// <summary>
    ///   <para>Adds a command to remove a given render target from fast GPU memory.</para>
    /// </summary>
    /// <param name="rid">The render target to remove from fast GPU memory.</param>
    /// <param name="copyContents">When this value is true, Unity copies the existing contents of the render target when it removes it from fast GPU memory. When this value is false, Unity does not copy the existing contents of the render target when it removes it from fast GPU memory. Set this value to true if you plan to add to the existing contents, and set it to false if you plan to overwrite or clear the existing contents. Where possible, set this value to false for better performance.</param>
    /// <param name="cmd"></param>
    [NativeConditional("UNITY_XBOXONE || UNITY_GAMECORE_XBOXONE")]
    public static void SwitchOutOfFastMemory(
      this CommandBuffer cmd,
      RenderTargetIdentifier rid,
      bool copyContents)
    {
      CommandBufferExtensions.Internal_SwitchOutOfFastMemory(cmd, ref rid, copyContents);
    }
  }
}
